package com.hubiao.spring.demo.action;

import com.hubiao.spring.demo.service.IQueryService;
import com.hubiao.spring.framework.annotation.HbAutowired;
import com.hubiao.spring.framework.annotation.HbController;
import com.hubiao.spring.framework.annotation.HbRequestMapping;
import com.hubiao.spring.framework.annotation.HbRequestParam;
import com.hubiao.spring.framework.webmvc.GPModelAndView;

import java.util.HashMap;
import java.util.Map;

/**
 * 公布接口url
 *
 * @author Tom
 */
@HbController
@HbRequestMapping("/")
public class PageAction {

    @HbAutowired
    IQueryService queryService;

    @HbRequestMapping("/first.html")
    public GPModelAndView query(@HbRequestParam("teacher") String teacher) {
        String result = queryService.query( teacher );
        Map<String, Object> model = new HashMap<String, Object>();
        model.put( "teacher", teacher );
        model.put( "data", result );
        model.put( "token", "123456" );
        return new GPModelAndView( "first.html", model );
    }

}
